import { request } from '../request';

/**
 * 手机号登录
 * @param phone
 * @param password
 */
export function loginApi(phone: string, password: string, remember: boolean) {
  return request<any>({
    url: '/v1/auth/login',
    method: 'post',
    data: {
      phone,
      password,
      remember
    }
  });
}

/**
 * 手机号注册 - 固定授权码
 * @param phone
 * @param password
 * @param auth_code
 */
export function registerApi(phone: string, password: string, auth_code: string) {
  return request<any>({
    url: '/v1/auth/register',
    method: 'post',
    data: {
      phone,
      password,
      auth_code
    }
  });
}


/** 获取用户个人信息*/
export function getUserApi() {
  return request<any>({
    url: '/v1/auth/user',
    method: 'get',
  });
}

/** 退出登录 */
export function logoutApi() {
  return request<boolean>({
    url: '/v1/auth/logout',
    method: 'post'
  });
}
